<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/cms/include/init_admin.jsp" %>
<%@ page import="com.qbooks.cms.sales.*" %>
<%

	HashList code004		= CommonUtil.getCodeList("004");			//권한
	HashList code019		= CommonUtil.getCodeList("019", "전체");		//OS
	HashList codeUseYn		= CommonUtil.getCodeList("use_yn");		//사용여부

	String s_sales_dt		= StringUtil.nvl(request.getParameter("s_sales_dt"), TODAY);
	String s_os_type		= StringUtil.nvl(request.getParameter("s_os_type"));
	String s_status			= StringUtil.nvl(request.getParameter("s_status"));
	String s_member_name	= StringUtil.toHan(request.getParameter("s_member_name"));
	String s_hp_no			= StringUtil.nvl(request.getParameter("s_hp_no"));

	HashMap infos = new HashMap();
	infos.put("sales_dt", 		s_sales_dt);
	infos.put("os_type", 		s_os_type);
	infos.put("status", 		s_status);
	infos.put("member_name",	s_member_name);
	infos.put("tel_no",			s_hp_no);

	SalesDAO dao = new SalesDAO();
	HashList list 	= dao.selectSalesList(infos);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><%= SYSTEM_NAME %></title>
	<%@ include file="/cms/include/cssnjs.jsp"  %>
	<script type="text/javascript">
	$(document).ready(function() {
		$('#s_name').focus().select();
		$('#list').find('tr').hover(
				function () { $(this).addClass("hover"); }
			  , function () { $(this).removeClass("hover"); }
			)
			.click(function(){
				//$('#asingono').val($(this).find('input:hidden[name=asingono]').val());
				//$('#searchForm').attr('action', './salesDetail.do');
				//$('#searchForm').submit();
			});
	});


	function fnExcelDownload() {
		$('#searchForm').attr('action', './licenseExcel.do');
		$('#searchForm').submit();
		$('#searchForm').attr('action', './licenseList.do');
	}

	</script>
</head>
<body>
<div id="wrap">
	<div id="top">
		<%@ include file="/cms/include/top.jsp" %>
	</div>
	<div id="page">
		<div id="menu">
			<%@ include file="/cms/include/leftMenu.jsp" %>
		</div>
		<div id="contents">
			<div class="menu_title">
				<h1>판매내역</h1>
				<p>CMS > 판매관리 > <b>판매내역</b></p>
			</div>
			<div class="clear line_01"></div>

			<form id="searchForm" method="post" action="./salesList.jsp">

			<table cellpadding="0" cellspacing="0" class="table_01 mt15">
			<colgroup>
				<col width="100px" />
				<col width="160px" />
				<col width="100px" />
				<col width="160px" />
				<col width="100px" />
				<col  />
			</colgroup>
			<tr>
			    <th><p>판매일자</p></th>
			    <td><input type="text" name="s_sales_dt" id="s_sales_dt" value="<%= s_sales_dt %>" class="w120"/></td>
				<th><p>상태</p></th>
				<td >
					<select name="s_status" class="w100">
					<%= StringUtil.makeOption(code004, s_status) %>
					</select>
				</td>
				<th><p>OS</p></th>
				<td class="brx">
					<select name="s_os_type" class="w100">
					<%= StringUtil.makeOption(code019, s_os_type) %>
					</select>
				</td>
			</tr>
			<tr>
			    <th><p>성명</p></th>
			    <td><input type="text" name="est_dt" id="est_dt" class="w120"/></td>
				<th><p>이메일</p></th>
				<td ><input type="text" name="est_dt" id="est_dt" class="w120"/></td>
				<th><p>연락처</p></th>
				<td class="brx"><input type="text" name="est_dt" id="est_dt" class="w120"/></td>
			</tr>
			</table>

			<div class="mt10 mb10 r">
				<input type="image" class="button" src="../images/btn_search.gif"/>
			</div>

			</form>

			<div class="search_result">검색결과 : <%=list.size() %>건</div>

		    <table cellpadding="0" cellspacing="0" class="table_03">
				<colgroup>
					<col width="100px"/>
					<col width="100px"/>
					<col width="100px"/>
					<col width="100px"/>
					<col width="100px"/>
					<col width="100px"/>
					<col width="100px"/>
					<col width="100px"/>
					<col width="100px"/>
					<col/>
				</colgroup>
				<thead>
					<tr>
						<th><p>판매일자</p></th>
						<th><p>큐북코드</p></th>
						<th><p>판매자</p></th>
						<th><p>구매회원</p></th>
						<th><p>OS</p></th>
						<th><p>스토어</p></th>
						<th><p>결재방법</p></th>
						<th><p>판매금액</p></th>
						<th><p>매출액</p></th>
						<th><p>상태</p></th>
					</tr>
				</thead>
				<tbody id="list">
				<%	for (int i = 0; i < list.size(); i++) { %>
					<tr>
						<td><%= StringUtil.toDate(list.get("sales_dt",i)) %></td>
						<td><%= list.get("book_code",i) %></td>
						<td><%= list.get("publisher_name",i) %></td>
						<td><%= list.get("member_id",i) %></td>
						<td><%= list.get("os_type",i) %></td>
						<td><%= list.get("store_name",i) %></td>
						<td><%= list.get("pay_method",i) %></td>
						<td><%= list.get("price",i) %></td>
						<td><%= list.get("sales_amount",i) %></td>
						<td><%= list.get("status_name",i) %></td>
					</tr>
				<%	} %>
				</tbody>
			</table>

			<div class="paging">

			</div>
		</div>
	</div>
</div>
</body>
</html>
